package org.qpcr.community.device.entity;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.hswebframework.ezorm.rdb.mapping.annotation.ColumnType;
import org.hswebframework.ezorm.rdb.mapping.annotation.Comment;
import org.hswebframework.web.api.crud.entity.GenericEntity;
import org.hswebframework.web.crud.annotation.EnableEntityEvent;
import org.hswebframework.web.crud.generator.Generators;
import org.hswebframework.web.validator.CreateGroup;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

@Getter
@Setter
@Table(name = "device_runtime")
@Comment("设备运行时长")
@EnableEntityEvent
public class DeviceRunTimeEntity extends GenericEntity<String> {

    @Override
    @Id
    @Column(length = 64, updatable = false)
    @Schema(description = "设备ID")
    @GeneratedValue(generator = Generators.SNOW_FLAKE)
    @NotBlank(message = "ID不能为空", groups = CreateGroup.class)
    public String getId() {
        return super.getId();
    }

    @Column(name = "run_time", length = 15)
    @Schema(description = "当前运行时长（分钟）")
    private long runTime;

    @Column(name = "run_time_total", length = 15)
    @Schema(description = "运行总时长（分钟）")
    private long runTimeTotal;

    @Column(name = "data_current", precision = 10, scale = 2)
    @Schema(description = "当前运行流量（m）")
    private Double dataCurrent;

    @Column(name = "data_total", precision = 10, scale = 2)
    @Schema(description = "运行总流量（m）")
    private Double dataTotal;

    @Column(name = "disk_empty", precision = 10, scale = 2)
    @Schema(description = "剩余空间（m）")
    private Double diskEmpty;

    @Column(name = "disk_total", precision = 10, scale = 2)
    @Schema(description = "总空间（m）")
    private Double diskTotal;

    @Column(name = "prodect_id", length = 64)
    @ColumnType(javaType = String.class)
    @Schema(description = "产品编号")
    private String prodectId;

}
